#ifndef DIALOGFREQUENCE_H
#define DIALOGFREQUENCE_H

#include <QDialog>
#include <QTableWidgetItem>

#include "frequencelist.h"



namespace Ui {
class DialogFrequence;
}

class DialogFrequence : public QDialog
{
    Q_OBJECT

public:
    explicit DialogFrequence(QWidget *parent = 0);
    ~DialogFrequence();

    void setFreqList(tv::FrequenceList& freqList);

    tv::FrequenceList& getFreqList();

private slots:
    void on_pushButtonAdd_clicked();

    void on_pushButtonDelete_clicked();

    void on_pushButtonEdit_clicked();

    void on_pushButtonImport_clicked();

    void on_pushButtonExport_clicked();

    void on_tableWidget_currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous);

protected:
    enum Role
    {
        kNumRole = Qt::UserRole + 1
    };

    void setFreq(int row, const tv::Frequence& freq);

    void appendFreq(const tv::Frequence& freq);

    void fillNumCombo();

    void showFreq(int row);
    void showFreq(const tv::Frequence& freq);

    void updateFreq(int row);

	void refreshTable();

private:
    Ui::DialogFrequence *ui;

private:
    tv::FrequenceList  m_freqList;

};

#endif // DIALOGFREQUENCE_H
